using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class controls_usrLoginStatus : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] != null && Session[CE.Global.General.UserTypeId] != null)
        {
            if (Convert.ToInt32(Session[CE.Global.General.UserTypeId]) ==
                Convert.ToInt32(CE.Global.CEUserType.Customer))
            {
                if (Session[CE.Global.General.UserEmail] != null)
                {
                    lblUserName.Text = Session[CE.Global.General.UserName].ToString();
                    liLoginStatus.Visible = true;
                    liLoginStatus.Attributes.Add("class", "signout");
                    hplLoginStatus.Text = "Sign Out";
                    hplLoginStatus.NavigateUrl = "~/User/Logout.aspx";

                    liRegister.Visible = false;
                    liSavedQuotes.Visible = true;
                    liEditProfile.Visible = true;
                }
                else
                {
                    lblUserName.Text = "No Email";
                    liLoginStatus.Attributes.Add("class", "signout");
                    liLoginStatus.Visible = true;
                    hplLoginStatus.Text = "Sign Out";
                    hplLoginStatus.NavigateUrl = "~/User/Logout.aspx";

                    liRegister.Visible = false;
                    liSavedQuotes.Visible = true;
                    liEditProfile.Visible = true;
                }
            }
            else if (Convert.ToInt32(Session[CE.Global.General.UserTypeId]) ==
                Convert.ToInt32(CE.Global.CEUserType.Provider))
            {
                if (Session[CE.Global.General.ProviderCompanyId] != null)
                {

                    if (Session[CE.Global.General.ProviderCompanyId].ToString() == "29")
                    {
                        lblUserName.Text = "UAT Site - Liberty Insurance";
                        liSavedQuotes.Visible = true;
                        hplSavedQuotes.Text = "UAT Site - Liberty Insurance Home";
                        hplSavedQuotes.NavigateUrl = "~/Provider/CarInsurance/LibertyInsuranceHome.aspx";
                        liEditProfile.Visible = false;
                        liLoginStatus.Visible = true;
                        liRegister.Visible = false;
                        hplLoginStatus.Text = "Sign Out";
                        hplLoginStatus.NavigateUrl = "~/User/Logout.aspx";
                    }
                    else if (Session[CE.Global.General.ProviderCompanyId].ToString() == "30")
                    {
                        lblUserName.Text = "UAT Site - Etiqa Insurance";
                        liSavedQuotes.Visible = true;
                        hplSavedQuotes.Text = "UAT Site - Etiqa Insurance Home";
                        hplSavedQuotes.NavigateUrl = "~/Provider/CarInsurance/LibertyInsuranceHome.aspx";
                        liEditProfile.Visible = false;
                        liLoginStatus.Visible = true;
                        liRegister.Visible = false;
                        hplLoginStatus.Text = "Sign Out";
                        hplLoginStatus.NavigateUrl = "~/User/Logout.aspx";
                    }
                    else if (Session[CE.Global.General.ProviderCompanyId].ToString() == "23")
                    {
                        lblUserName.Text = "UAT Site - HSBC Insurance";
                        liSavedQuotes.Visible = true;
                        hplSavedQuotes.Text = "UAT Site - HSBC Insurance Home";
                        hplSavedQuotes.NavigateUrl = "~/Provider/CarInsurance/LibertyInsuranceHome.aspx";
                        liEditProfile.Visible = false;
                        liLoginStatus.Visible = true;
                        liRegister.Visible = false;
                        hplLoginStatus.Text = "Sign Out";
                        hplLoginStatus.NavigateUrl = "~/User/Logout.aspx";
                    }
                    else if (Session[CE.Global.General.ProviderCompanyId].ToString() == "28")
                    {
                        lblUserName.Text = "UAT Site - MayBank";
                        liSavedQuotes.Visible = true;
                        hplSavedQuotes.Text = "UAT Site - MayBank Home";
                        hplSavedQuotes.NavigateUrl = "~/Provider/HomeRefinancing/HFHome.aspx";
                        liEditProfile.Visible = false;
                        liLoginStatus.Visible = true;
                        liRegister.Visible = false;
                        hplLoginStatus.Text = "Sign Out";
                        hplLoginStatus.NavigateUrl = "~/User/Logout.aspx";
                    }
                    else
                    {
                        lblUserName.Text = "UAT Site - Provider";
                        liLoginStatus.Visible = true;
                        hplLoginStatus.Text = "Sign Out";
                        hplLoginStatus.NavigateUrl = "~/User/Logout.aspx";
                    }
                }
                else
                {
                    lblUserName.Text = "UAT Site - Provider";
                    liLoginStatus.Visible = true;
                    hplLoginStatus.Text = "Sign Out";
                    hplLoginStatus.NavigateUrl = "~/User/Logout.aspx";
                }
            }
            else
            {
                lblUserName.Text = "";
                liLoginStatus.Attributes.Add("class", "first");
                liLoginStatus.Visible = true;
                hplLoginStatus.Text = "Sign In";
                hplLoginStatus.NavigateUrl = "~/User/LoginAndRegister.aspx";

                liRegister.Visible = true;
                liSavedQuotes.Visible = false;
                liEditProfile.Visible = false;
            }
        }
        else
        {
            //lblUserName.Text = "";
            //liLoginStatus.Attributes.Add("class", "first");
            //hplLoginStatus.Text = "Sign In";
            //hplLoginStatus.NavigateUrl = "~/User/LoginAndRegister.aspx";

            //liRegister.Visible = true;
            //liSavedQuotes.Visible = false;
            //liEditProfile.Visible = false;
            //liLoginStatus.Visible = false;
            //liRegister.Visible = false;
            divUserInfo.Visible = false;
        }
    }
}
